// app.js

const pageInfo = require('./common/pageInfo');
const util = require('./common/util');

App({
  onLaunch() {
    // 展示本地存储能力
    const logs = wx.getStorageSync('logs') || []
    logs.unshift(Date.now())
    wx.setStorageSync('logs', logs)

    // 登录
    wx.login({
      success: res => {
        // 发送 res.code 到后台换取 openId, sessionKey, unionId
      }
    })

    // 系统信息
    const sysInfo = pageInfo.getSystemInfo();
    const globalData = this.globalData;
    util.setJsonProps(globalData, sysInfo);
  },

  globalData: {
    userInfo: null,
    scrWidth: 0,
    scrHeight: 0,
    winWidth: 0,
    winHeight: 0,
    navHeigh: 0,
    staBarHeight: 0,
    titleHight: 0,
    capWidth: 0,
    capHeight: 0,
    capTop: 0,
    capRight: 0,
    capBottom: 0,
    capLeft: 0
  }
})